home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
graphic
/
xv_pc16a.zip
/
XVIEW.H
< prev
next >
Wrap
C/C++ Source or Header
|
1994-04-20
|
11KB
|
245 lines
#ifndef XVIEWH
#define XVIEWH
#include <graphics.h>
/*
Header for the XView-PC graphical user interface. Turbo C version.
By Antonio Carlos Moreirao de Queiroz - acmq@coe.ufrj.br
Version 1.0 - 05/07/92
Version 1.6 - 20/11/93 Large images
Version 1.6a - 15/04/94 As version 1.6a in Pascal
The C version of the package is formed by the files:
XVIEW.H, XVIEW.OBJ: Interface routines.
MICKEY.H, MICKEY.OBJ: Mouse support.
X_MAKE.EXE: Interface editor for Pascal and C.
To compile a program:
- Use Turbo C++ 1.0 or later version.
- Open a project with MICKEY.OBJ, XVIEW.OBJ, and the C source files.
- Turn on the linking with the graphics and floating point libraries.
- Set the memory model to "huge".
- Set the CPP extensions only option.
- Or for use with a C++ program, set the C++ always option, and use
the .OBJ files in the file XVCPP.ZIP.
- The object files were generated with Borland C++ 3.1.
Some incompatibilities with other versions, specially in the C++ version,
may exist.
- The BGI drivers needed may be also of a different version than the ones
provided for the Turbo Pascal 7.0 version.
This documentation covers only the differences between the Pascal and C
versions. See the files XVIEW_PC.TXT and XVIEW.INT for more details.
General observations:
The fields of the "xv_widget" union are acessed in a more complex form.
Examples:
"obj^.x" translates to "obj->x"
"obj^.sel_menu" translates to "obj->v.smenu.sel_menu"
"obj^.gr_out.x1" translates to "obj->v.sframe.gra-out.left"
An idea is to use defines for common fields, or to implement functions to
access the object fields, like the Sun XView "xv_create, "xv_set" and
"xv_get" functions.
Memory usage:
Each object uses in the heap:
- "sizeof(xv_widget)" bytes (262).
- The size of the buffers used in "tty" objects, "bsize"+1.
- If a frame that is in the screen and above another, its area "areaw".
No extra memory is allocated for the items of menus and settings.
********************************************************************************
*/
/*
* The variables marked "*" are reserved, and shall not be changed.
* The variables marked "#" are the ones usually initialized at creation.
* The others can be freely changed.
*/
#define LOC_MOVE 256
/* event: mouse moved */
#define LOC_DRAG 257
/* event: mouse moved with pressed buttons */
#define MS_LEFT 1001
/* event: left button pressed */
#define MS_MIDDLE 1004
/* event: middle button pressed */
#define MS_RIGHT 1002
/* event: right button pressed */
#define m_itens 20
/* maximum number of items in menus and settings (only 16 in settings) */
#define m_chars 59
/* caracters in strings */
#define mrgx 5
/* lateral and bottom margins in the windows */
#define mrgy 22
/* upper margin in the windows */
typedef struct widget *Xv_opaque; /* C++ */
typedef enum { text_field,real_field,int_field } t_field_type;
typedef struct figstruct { /* structue for images */
int blocks; /* number of image blocks -1 */
unsigned int blocksize,lastblocksize; /* size of the blocks */
void *v[2001]; /* allocated until "blocks" */
} figstruct;
typedef struct figstruct *ptrfig; /* imagem pointer */
typedef void (*xv_handler)(Xv_opaque obj);
typedef enum { frame,button,textfield,setting,message,canvas,tty,menu } xv_package;
typedef char xv_label_type[m_chars+1];
typedef struct widget {
xv_label_type xv_label; /* # title */
int x,y,dx,dy; /* # position and size */
int fore_color,back_color; /* # colors */
Xv_opaque owner; /* * frame where the object is */
Xv_opaque next; /* * next objeto */
Xv_opaque menu_name; /* # associated menu */
xv_handler notify_handler; /* # notify handler */
xv_handler event_handler; /* # event handler */
void *client_data; /* # other associated values */
xv_package o_type; /* * object type */
union {
struct { Xv_opaque over;
Xv_opaque under; /* * neighbor window frames */
ptrfig Pw; /* * covered image */
long int areaw; /* * size of image */
int dxmin, dymin; /* # minimum size */
int interfere; /* * used internally */
int mapped; /* * if the window is in the screen */
int adjust_exit; /* # if the window can ba closed with the central mouse button */
Xv_opaque mouse_obj; /* # initial location of the mouse (object), or nil */
struct viewporttype gr_out; } sframe; /* * viewport */
struct { int icon_label; /* # if "xv_label" is a bitmap file name */
ptrfig Pimageb; } sbutton; /* * button image */
struct { int icon_msg; /* # if "xv_label" is a bitmap filename */
ptrfig Pimagem; } smessage; /* * message image */
struct { xv_label_type panel_value; /* # text */
double panel_real; /* # corresponding real */
int panel_int; /* # corresponding integer */
int min_value, max_value; /* # integer limits */
int value_length; /* # characters shown */
t_field_type field_type; } stextfield; /* type */
struct { int itens_setting; /* * number of items */
int sel_setting; /* # selection */
char *item_setting[m_itens]; /* * item strings */
int exclusive; } ssetting; /* # if selection is exclusive */
struct { int can_xext,can_yext; } scanvas; /* # if extends to the borders */
struct { int tty_xext,tty_yext; /* # " */
int xc,yc; /* * graphical cursors */
unsigned int bsize; /* * buffer size */
unsigned bcsr; /* * buffer cursor */
unsigned bstart,tstart,tend; /* * buffer pointers */
int dxtty; /* * effective width */
char *Pb; } stty; /* * text buffer */
struct { int itens_menu; /* * number of de items */
int sel_menu; /* # selected item */
char *item_menu[m_itens]; /* * item strings */
Xv_opaque item_submenu[m_itens]; } smenu; /* # submenus */
} v;
} widget;
extern int wallpaper; /* 0 # if the background is to be retained */
extern unsigned int normal_bsize; /* # "bsize" (tty) attributed by "xv_create" */
extern unsigned int normal_length; /* # "value_length" (textfield) attributed by "xv_create" */
extern int c_normal; /* LIGHTGRAY object background color */
extern int c_active; /* GREEN pressed buttons color */
extern int c_light; /* WHITE lighted corners color */
extern int c_shadow; /* BLACK shadowed corners color */
extern int c_white; /* WHITE default "back_color" */
extern int c_black; /* BLACK default "fore_color" */
extern int c_overwrite; /* LIGHTRED overwrite color in textfields */
extern int c_edit; /* BLUE edit color in textfields */
extern int c_insert; /* YELLOW insert color in textfields */
extern int c_hatch; /* CYAN background pattern color */
extern int type_hatch; /* XHATCH_FILL background color */
extern int use_palette; /* 1 if bitmap palettes are accepted */
extern void *normal_client_data; /* NULL attributed to "client_data" by "xv_create" */
extern int nlines; /* * 60, number of lines per image block */
extern int insert; /* 1 if textfields are insert mode */
extern int xv_ok; /* * resultd of the last window operation */
extern int xv_end; /* terminates "xv_main_loop" */
extern xv_label_type ulttxt; /* last text read in textfields */
extern int ie_locx,ie_locy; /* * mouse position relative to